import MapLogic, {getBuildName, pushBuildName} from "./MapLogic";

const {ccclass, property} = cc._decorator;

@ccclass
export default class BuildItem extends cc.Component {

    @property(cc.Label) decLabel:cc.Label = null;

    map:MapLogic = null;

    init(str,map){
        // console.log(str);
        this.map = map;
        this.decLabel.string = str;
    }

    onClickSelf(){
        let number = getBuildName.findIndex(value => value == this.decLabel.string);
        if(number == -1) {
            let number1 = pushBuildName.findIndex(value => value == this.decLabel.string);
            this.map.sureBuild(number1);


        }else {
            this.map.sureBuild(number);

        }
    }

}
